package com.demo.repository;

import com.demo.entity.Sale;

import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.query.Param;

import java.util.List;

public interface SaleRepo extends PagingAndSortingRepository<Sale, Integer> {

    void deleteByCreateDate(String createDate);


   // @Query(value="select * from sale a where a.house like CONCAT('%',:house,'%') and create_date>=:date",nativeQuery=true)
    List<Sale> findByHouseAndCreateDateAfterOrderByCreateDate(String house, String date);


    @Query(value="select * from sale a where a.house like CONCAT('%',:house,'%') and create_date>=:date",nativeQuery=true)
    List<Sale> search(@Param("house") String house, @Param("date") String date);
}
